import { calcSystemInfoMenuButtonRectInfo } from "./calcSystemInfoMenuButtonRectInfo";

/**
 * 获取全局数据
 */
export function getAppGlobalData() {
  const app = getApp<IAppOption>();
  return app.globalData;
}
/**
 * 顶部导航已占用高度.
 */
export function getTopOccupiedHeight() {
  return getAppGlobalData().systemInfoMenuButtonRectInfo.topOccupiedHeight;
}
export function getTopSafetyAreaHeight() {
  return getAppGlobalData().systemInfoMenuButtonRectInfo.topSafetyAreaHeight;
}
/**
 * 更新设备信息(安全区信息以及屏幕旋转方向)
 */
export function updateSystemInfoMenuButtonRectInfo() {
  getAppGlobalData().systemInfoMenuButtonRectInfo =
    calcSystemInfoMenuButtonRectInfo();
}

/**
 * 获取设备方向
 */
export function getDeviceOrientation() {
  return getAppGlobalData().systemInfoMenuButtonRectInfo.deviceOrientation;
}
